package com.softhis.rekrutacja.shared.services;

import java.util.List;

import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
import com.softhis.rekrutacja.shared.beans.LoginBean;
import com.softhis.rekrutacja.shared.dto.UserDTO;

/**
 * @author Sasak
 *
 */
@RemoteServiceRelativePath("springGwtServices/userService")
public interface UserService extends RemoteService {
	
    public enum SaveUserCode {
        /**
         * code which indicates that registration was successful
         */
        OK,
        /**
         * code which indicates that supplied login is already in use
         */
        LOGIN_IN_USE,
        /**
         * code which indicates that unknown error occurred 
         */
        UNKNOWN_EROR,
    }

	public UserDTO findUser(int userId);

	public void deleteUser(int userId) throws Exception;

	public SaveUserCode saveUser(UserDTO user) throws Exception;

	public SaveUserCode updateUser(UserDTO user) throws Exception;
	
	public List<UserDTO> getAllUsersList() throws Exception;

	public LoginBean refreshSession();

	public String isSessionValid(String sessionID);

	public LoginBean loginUser(String login, String password);

	public void logout(String sessionId);

	public boolean loginAlreadyInUse(String login);

}